import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { modifyUser } from '../store/actions'

export default function User() {
  const user = useSelector((state) => state.user)
  const dispatch = useDispatch()
  return (
    <div>
      <h3>{user.username}</h3>
      <button onClick={() => dispatch(modifyUser({ username: 'yyyyyyy' }))}>
        修改name
      </button>
    </div>
  )
}
